import org.molamil.acto.core.EventConstants;
import org.molamil.acto.core.Logger;
import org.molamil.acto.mc.mcw.LcMcWrapper;
import org.molamil.acto.pages.master.AbstractMovieMaster;
import org.molamil.acto.pages.master.MovieMaster;

/**
 * @author hernandezjo
 */
class org.molamil.acto.pages.master.MovieMasterDelegate {
	
	
	// Properties
	
	private static var log:Logger = Logger.getLogger("MovieMasterDelegate");
	
	private var master:MovieMaster;
	
	
	// Constructor
	
	public function MovieMasterDelegate(master:MovieMaster) {
		log.debug("Constructor");
		this.master = master;
	}
	
	
	// Listeners

	public function mcStateChangeListener(eventObject:Object):Void {
		
		log.debug("mcStateChangeListener(), state = " + eventObject.state);
		
		if (eventObject.state == LcMcWrapper.STATE_IN) {
			var eventObject:Object = {target: master, type: EventConstants.MOVIE_IN};
			AbstractMovieMaster(master).dispatchEvent(eventObject);
		} else if (eventObject.state == LcMcWrapper.STATE_ON) {
			var eventObject:Object = {target: master, type: EventConstants.MOVIE_ON};
			AbstractMovieMaster(master).dispatchEvent(eventObject);
		} else if (eventObject.state == LcMcWrapper.STATE_OUT) {
			var eventObject:Object = {target: master, type: EventConstants.MOVIE_OUT};
			AbstractMovieMaster(master).dispatchEvent(eventObject);
		} else if (eventObject.state == LcMcWrapper.STATE_OFF) {
			var eventObject:Object = {target: master, type: EventConstants.MOVIE_OFF};
			AbstractMovieMaster(master).dispatchEvent(eventObject);
		}
		
	}
	
	
}